package com.ruoyi.yuyuan.Mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.yuyuan.Entity.BlogAgreement;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: kestrel
 * @Version:1.0
 * @Date: 2024/5/29
 */
@Mapper
public interface AgreementBlogMapper extends BaseMapper<BlogAgreement> {
    @Select("select * from tb_blog_agreement where id < #{startId} and status < 2 and agreement_type = #{blogType} order by create_time DESC,id DESC limit 6")
    List<BlogAgreement> getAgreements(Short blogType, Long startId);
    @Select("select max(id) from tb_blog_agreement where status < 2 and agreement_type = #{blogType} order by id limit 1")
    Long getMaxStartId(Long blogType);

    BlogAgreement queryHotBlog();
}
